// share.js

// url - 需要分享的页面地址（当前页面地址）
// title - 分享的标题（文章标题）

const toQQzone = (urls: any, titles: any) => {
  let url = encodeURIComponent(urls);
  let title = encodeURIComponent(titles);
  window.open(
    `https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=${url}&title=${title}&desc=${title}&summary=${title}&site=${url}`,
  );
};

const toQQ = (urls: any, titles: any) => {
  let url = encodeURIComponent(urls);
  let title = encodeURIComponent(titles);
  window.open(
    `https://connect.qq.com/widget/shareqq/index.html?url=${url}&title=${title}&source=${url}&desc=${title}&pics=`,
  );
};

const toWeibo = (urls: any, titles: any) => {
  let url = encodeURIComponent(urls);
  let title = encodeURIComponent(titles);
  window.open(`https://service.weibo.com/share/share.php?url=${url}&title=${title}&pic=&appkey=&sudaref=`);
};

const toWechat = (urls: any, titles: any) => {
  // let url = encodeURIComponent(urls)
  // let title = encodeURIComponent(titles)
  // // console.log(21, process.env.NUXT_ENV_APISERVER)
  // window.open(`${process.env.NUXT_ENV_APISERVER}/sharetoWechat?url=${url}&title=${title}`)
};
export { toQQzone, toQQ, toWeibo, toWechat };
